#ifndef CJSONPARSER_H
#define CJSONPARSER_H

#include "cjsoncommon.h"
#include "cjsonobject.h"
#include <list>

class CJsonParser
{
private:
  class CJsonPare : public std::pair <jstring, CJsonValue*>
  {
  public:
    CJsonPare();
    CJsonPare(jstring f, CJsonValue * s);
    ~CJsonPare();
  };
  struct fifo_node
  {
    CJsonValue *obj;
    std::list <CJsonPare*> pares_fifo;
    fifo_node();
    fifo_node(CJsonValue *obj, CJsonPare *pare);
    ~fifo_node();
  };
  static long small_pow(long base, unsigned grade);
  static CJsonValue * recognize_unknown(jstring & temp_string);
  static inline void clean_up_before_error(CJsonObject *o, std::list <fifo_node*> l);
public:
  LIB_PRE static CJsonObject * Execute(jstring & json_string);
};

#endif//CJSONPARSER_H

